package com.corgi.quartz.job;

import com.corgi.quartz.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.Instant;

/**
 * @title: QuartzJob
 * @description: 任务类
 * @author: dengmiao
 * @create: 2019-11-11 14:38
 **/
@Slf4j
public class QuartzJob implements Job {

    @Autowired
    private UserService userService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("execute in {}", Instant.now());
        this.userService.addUser();
    }
}
